package com.lottery.common.entity;

    import com.baomidou.mybatisplus.annotation.IdType;
    import com.baomidou.mybatisplus.annotation.TableField;
    import com.baomidou.mybatisplus.annotation.TableId;
    import com.baomidou.mybatisplus.annotation.TableName;
    import com.lottery.common.model.BaseModel;

    import java.math.BigDecimal;
    import java.util.Date;

    import io.swagger.annotations.ApiModel;
    import io.swagger.annotations.ApiModelProperty;
    import lombok.Data;
    import lombok.EqualsAndHashCode;
    import lombok.experimental.Accessors;

/**
* <p>
    * 支付记录
    * </p>
*
* @author jobob
* @since 2019-09-23
*/
    @Data
    @TableName("tb_payment_records")
    @ApiModel(value="TbPaymentRecords对象", description="支付记录")
    public class PaymentRecords {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "支付类型 1 支付宝 2微信 3 余额 4 免费额度 5 代金券支付")
    private Integer type;

    @ApiModelProperty(value = "支付方式 1app 2 h5 3 支付宝web  4 jsapi 5小程序")
    private Integer payType;

    @ApiModelProperty(value = "订单编号")
    private String orderNum;

    @ApiModelProperty(value = "订单金额")
    private BigDecimal totalFee;

    @ApiModelProperty(value = "支付宝单号")
    private String tradeNo;

    @ApiModelProperty(value = "状态 0支付成功 1 待支付  2支付中 3 支付失败 4 退款 5 退款成功 6 退款失败  7 异常")
    private Integer status;

    private Date payTime;

    private Date endTime;

    private Date createTime;

    private String resultCode;

    private String errorCode;

    private String errorMsg;

    @TableField(exist=false)
    private String body;//商品标题
    @TableField(exist=false)
    private String openId;
    @TableField(exist=false)
    private String ip;
    @TableField(exist=false)
    private Long memberId;

    public PaymentRecords() {

    }


    public PaymentRecords(String orderNum, Integer status) {
        this.orderNum = orderNum;
        this.status = status;
    }

    public PaymentRecords(Integer type, Integer payType, String orderNum, String paymentCode) {
        this.type = type;
        this.payType = payType;
        this.orderNum = orderNum;
    }

    //创建支付订单
    public PaymentRecords(Integer type, Integer payType, String orderNum, BigDecimal totalFee, Integer status) {
        this.type = type;
        this.payType = payType;
        this.orderNum = orderNum;
        this.totalFee = totalFee;
        this.status = status;
//        this.createTime = new Date();
    }

    //订单支付
    public PaymentRecords(String orderNum, Date payTime, Integer status) {
        this.orderNum = orderNum;
        this.payTime = payTime;
        this.status = status;

    }

    //支付回调
    public PaymentRecords(String orderNum, String tradeNo,Date endTime, String resultCode, String errorCode, String errorMsg) {
        this.orderNum = orderNum;
        this.tradeNo = tradeNo;
        this.endTime = endTime;
        this.resultCode = resultCode;
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    
}
